
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加新文章</title>
<link rel="stylesheet" href="styles/style.css" type="text/css" media="all">
</head>
<?php
session_start();
header("content-type:text/html;charset=utf-8");
include "Mysql/MySqlClass.php";
$mySQL       = new Ycf\Lession\MySqlClass\MySqlClass('jinling_company', 'root', '123456');
$noticeWhere = array('id' => $_GET['noticId']);
$notice      = ($mySQL->select("notice", $noticeWhere));
if (!empty($_POST['title'])) {
    $noticeTitle   = $_POST['title'];
    $noticeContent = $_POST['content'];
    $noticeDate    = date('y-m-d h:i:s', time()); //当前的编辑时间
    $admin         = $mySQL->select("admin", $where = array('adminName' => $_SESSION['userName']));
    $set           = array('noticeTitle' => $noticeTitle, 'noticeContent' => $noticeContent, 'noticeDate' => $noticeDate, 'adminId' => $admin['id']);
    $MySQL->update("notice", $set, $noticeWhere);
    header("Location:newsList.php");
}
;
?>
<body>
<div class="container">
    <h3 class="marginbot">最新公告编辑<a href="newsList.php" class="sgbtn">返回公告列表</a></h3>
    <div class="mainbox">
        <form action="" method="post">
            <table class="opt" style="width:600px;">
                <tbody>
                    <tr>
                        <th>文章名称：</th>
                    </tr>
                    <tr>
                        <td>
                        <input name="title" class="txt"   value="<?php echo $notice['noticeTitle']; ?>" style="width:400px;" type="text">
                        </td>
                    </tr>
                    <tr>
                        <th>文章内容：</th>
                    </tr>
                    <tr>
                        <td><textarea style="width:400px; height:150px" name="content"><?php echo $notice['noticeContent']; ?></textarea></td>
                    </tr>
                </tbody>
            </table>

            <div class="opt"><input name="submit" value=" 提 交 " class="btn" tabindex="3" type="submit"></div>
        </form>
    </div>
</div>
</body>
</html>
